package com.review.Test.Provider_Consumer;

import java.util.concurrent.LinkedBlockingQueue;

public class Consumer implements Runnable{
	 
	private LinkedBlockingQueue<Data> queue;
	private volatile boolean isRun = true;

	public Consumer(LinkedBlockingQueue<Data> queue) {
		super();
		this.queue = queue;
	}

	@Override
	public void run() {
		while (isRun) {
			try {
				Data data = this.queue.take();
				System.out.println("出队：  " + data);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
		
	}
	
	public void stop(){
		this.isRun = false;
	}
	
	
}
